#!C:\ruby\bin\ruby.exe
require 'rexml/document'
require 'rexml/streamlistener'
include REXML

lista_tags = {"mueble" => 'furniture', "micasa" => 'myhouse', "habitacion" => 'room'}

file=ARGV[0]
class Escucha
  include StreamListener
  
  def initialize(lista_tags)
  
   @tag = lista_tags
  end
  
  def tag_start(name, attributes)
    puts "<"+@tag[name]+">"
  end

  def tag_end(name)
    puts "</"+@tag[name]+">"
  end
  
  def text(text) 
    puts text
  end 
  
end

print "Content-Type: application/xhtml+xml\n\n"

listener = Escucha.new(lista_tags) 
parser = Parsers::StreamParser.new(File.new(file),listener) 
parser.parse
